package com.ruoyi.daily.controller;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.daily.domain.dto.RechargeOrWithdrawalReviewDto;
import com.ruoyi.daily.domain.dto.SettlementOfBranchHeadquartersDto;
import com.ruoyi.daily.domain.vo.RechargeOrWithdrawalReviewVo;
import com.ruoyi.daily.service.BranchSettlementService;
import com.ruoyi.logistic.domain.NetworkJuniorBill;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @Author cmz
 * @Date 2024-05-30 17:59
 */
@RestController
@RequestMapping("/daily/branchSettlement")
@Api(tags = "经营日报-网点结算")
public class BranchSettlementController {
    @Resource
    private BranchSettlementService branchSettlementService;

    
    @ApiOperation("网点总部结算")
    @GetMapping("/settlementOfBranchHeadquarters")
    public R<SettlementOfBranchHeadquartersDto> settlementOfBranchHeadquarters() {
        return branchSettlementService.settlementOfBranchHeadquarters();
    }
    
    @ApiOperation("账单收支分析")
    @GetMapping("/billDataShow")
    public R billDataShow() {
        List<Map<String,Object>> hqBillDataShows = branchSettlementService.billDataShow();
        return R.ok(hqBillDataShows);
    }

    @ApiOperation("充值或提现审核")
    @PostMapping("/rechargeOrWithdrawalReview")
    public R<List<RechargeOrWithdrawalReviewDto>> rechargeOrWithdrawalReview(@RequestBody RechargeOrWithdrawalReviewVo rechargeOrWithdrawalReviewVo) {
        return branchSettlementService.rechargeOrWithdrawalReview(rechargeOrWithdrawalReviewVo);
    }

    @ApiOperation("预警配置(查询)")
    @GetMapping("/warningConfiguration/{accountCode}")
    public R<NetworkJuniorBill> warningConfiguration(@PathVariable String accountCode) {
        return branchSettlementService.warningConfiguration(accountCode);
    }
    @ApiOperation("预警配置(保存)")
    @PostMapping("/saveWarningConfiguration")
    public R saveWarningConfiguration(@RequestBody NetworkJuniorBill networkJuniorBill) {
        return branchSettlementService.saveWarningConfiguration(networkJuniorBill);
    }
}
